﻿Imports System.Web.Script.Serialization
Public Class JsonHelper
    ''' <summary>
    ''' 将对象转换成Json字符串
    ''' </summary>
    ''' <param name="obj">要转换的对象</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function ToJson(ByVal obj As Object) As String
        Try
            Dim serializer As JavaScriptSerializer = New JavaScriptSerializer()
            Return serializer.Serialize(obj)
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Function

End Class
